{% extends 'releases/base.html' %}
{% block titel %}发布管理系统-lvs配置页{% endblock %}
{% block link %}
    <link rel="stylesheet" href="/static/releases/css/compiled/user-list.css" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="/static/releases/css/jenkinsxiugaiye.css" />
    <link rel="stylesheet" href="/static/releases/css/compiled/new-user.css" type="text/css" media="screen" />
{% endblock %}

{% block body %}
    	<!-- main container -->
    <div class="content">
    {% if zhuangtai %}
        <div id="zhuangtai2" class="alert alert-success alert-dismissible" role="alert">
    {% else %}
        <div style="display: none"  id="zhuangtai2" class="alert alert-success alert-dismissible" role="alert">
    {% endif %}
		  <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only"></span></button>
		  <strong>保存成功!</strong>
		</div>
        <div class="container-fluid">
            <div id="pad-wrapper" class="new-user">
                <div class="row-fluid header">
                    <h3>LVS 配置</h3>
                    <h5 id="xinghao">* 必填</h5>
                </div>

                <div class="row-fluid form-wrapper">
                    <!-- left column -->
                    <div class="span9 with-sidebar">
                        <div class="container">
                            <form class="new_user_form inline-input" action="/releases/lvsmodify/" method="post"/>
                                {% csrf_token %}
                                <div class="span12 field-box">
                                    <label id="zhanghu1" >*连接账户:</label>
                                    <input class="span9" id="zhanghu" type="text" name="username" value="{{ modify.username }}" placeholder="连接服务器账户，如root"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="mima1">*密码:</label>
                                    <input class="span9"  type="password" id="mima" name="password" value="{{ modify.password }}" placeholder="连接账户密码"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="ipdizhi1">*外网lvs,IP地址:</label>
                                    <input class="span9" id="ipdizhi" type="text" name="ipdizhi" value="{{ modify.IP }}" placeholder="外网LVS服务器IP地址"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="ipdizhi2">*内网lvs,IP地址:</label>
                                    <input class="span9" id="ipdizhi2" type="text" name="ipdizhi2" value="{{ modify.IntranetIP }}" placeholder="内网LVS服务器IP地址"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="jiaoben1">*脚本位置:</label>
                                    <input class="span9" id="jiaoben" type="text" name="jiaoben" value="{{ modify.ScriptLocation }}" placeholder="LVS服务器上的修改脚本位置"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="yizu1">*外网第一组编排:</label>
                                    <input class="span9" id="yizu" type="text" name="onegroup" value="{{ modify.onegroup }}" placeholder="外网下线第一组的机器编排，请以,分隔"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="erzu1">*外网第二组编排:</label>
                                    <input class="span9" id="erzu" type="text" name="twogroup" value="{{ modify.twogroup }}" placeholder="外网下线第二组的机器编排，请以,分隔"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="Intranetyizu1">*内网第一组编排:</label>
                                    <input class="span9" id="Intranetyizu" type="text" name="Intranetonegroup" value="{{ modify.Intranetonegroup }}" placeholder="内网下线第一组的机器编排，请以,分隔"/>
                                </div>
                                <div class="span12 field-box">
                                    <label id="Intraneterzu1">*内网第二组编排:</label>
                                    <input class="span9" id="Intraneterzu" type="text" name="Intranettwogroup" value="{{ modify.Intranettwogroup }}" placeholder="内网下线第二组的机器编排，请以,分隔"/>
                                </div>
                                <div class="span12 field-box textarea">
                                    <label>备注:</label>
                                    <textarea class="span9" name="Remark" placeholder="备注及说明">{{ modify.Remark }}</textarea>
                                    <!--<span class="charactersleft">小于256字</span>-->
                                </div>
                                <div class="span11 field-box actions">
                                    <input type="submit" class="btn-glow primary" value="确认修改" onclick="return checkNull()" />
                                    <span>OR</span>
                                    <input type="reset" value="重置" class="reset" />
                                </div>
                           </form>
                        </div>
                    </div>

                    <!-- side right column -->
                    <div class="span3 form-sidebar pull-right">
                        <div class="alert alert-info hidden-tablet">
                            <i class="icon-lightbulb pull-left"></i>
                            	请谨慎填写相关配置，用户名及密码。
                        </div>
                        <!--<h6>Sidebar text for instructions</h6>
                        <p>Add multiple users at once</p>
                        <p>Choose one of the following file types:</p>-->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- end main container -->
{% endblock %}

{% block javascript %}
    <script type="text/javascript">
        $(document).ready(function(){
            var $canshu=$('#fbmodify');
            var $span=$('<div class="pointer"> <div class="arrow"></div> <div class="arrow_border"></div> </div>');
            $($canshu).append($span);
            $($canshu).addClass("active");
            $('#lvsmodify').addClass("active");
            $('#fbmodifyul').addClass("active");
    })
    </script>
    <script type="text/javascript">
        function checkNull()
        {
            var username=$("#zhanghu").val();
            var password=$("#mima").val();
            var ipdizhi=$("#ipdizhi").val();
            var jiaoben=$("#jiaoben").val();
            var yizu=$("#yizu").val();
            var erzu=$("#erzu").val();

            if(username==""){
            //显示错误提示信息
            $("#zhanghu").attr('placeholder','不得为空');
            $("#zhanghu1").css('color','red');
            return false;
        }else{
            $("#zhanghu1").css('color','');
        }
        if(password==""){
            $("#mima").attr('placeholder','不得为空');
            $("#mima1").css('color','red');
            return false;
        }else{
            $("#mima1").css('color','');
        }
            if(ipdizhi==""){
            $("#ipdizhi").attr('placeholder','不得为空')
            $("#ipdizhi1").css('color','red')
            return false;
        }else{
            $("#ipdizhi1").css('color','');
        }
            if(jiaoben==""){
            $("#jioaben").attr('placeholder','不得为空')
            $("#jiaoben1").css('color','red')
            return false;
        }else{
            $("#jiaoben1").css('color','');
        }
            if(yizu==""){
            $("#yizu").attr('placeholder','不得为空')
            $("#yizu1").css('color','red')
            return false;
        }else{
            $("#yizu1").css('color','');
        }
            if(erzu==""){
            $("#erzu").attr('placeholder','不得为空')
            $("#erzu1").css('color','red')
            return false;
        }else{
            $("#erzu1").css('color','');
        }
        return true;
             };
    </script>
{% endblock %}